package com.rocketmq.consumer.listener;

import com.cyn.aframework.constants.constant.RocketConstant;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Service;

/**
 * @author Wilson
 * @since 2019/11/27
 **/
@RocketMQMessageListener(consumerGroup = RocketConstant.ConsumerGroup.SPRING_BOOT_CONSUMER, topic = RocketConstant.Topic.SPRING_BOOT_TOPIC)
@Service
public class StringConsumerListener implements RocketMQListener<MessageExt> {


    @Override
    public void onMessage(MessageExt messageExt) {
//        String url = "http://192.168.109.130/platform/successKilled/skilledByRedisLock";
//        String url = "http://192.168.109.132:18080/platform/successKilled/skilledByRedisLock";
//        String url = "http://localhost:18080/platform/successKilled/ ";
//        String params = "";
//        params = "userPhone=15261115811&projectId=121183&index="+new String(messageExt.getBody());
//        String tmp = HttpUtils.sendGet(url,params);


        System.out.println(new String(messageExt.getBody()));
//        System.out.println(messageExt.getQueueId()+":"+new String(messageExt.getBody()));
//        log.info("receive message: {}, queue: {}", new String(messageExt.getBody()), messageExt.getQueueId());
    }
}
